﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BLE_Barcode
{
    public partial class CopyScream : Form
    {
        public Image curImg = null;
        public CopyScream()
        {
            InitializeComponent();
        }

       private void CopyScream_Load(object sender, EventArgs e)
        {
            Rectangle rtg = Screen.PrimaryScreen.Bounds;
            Image ig = new Bitmap(rtg.Width, rtg.Height);
            Graphics gr = Graphics.FromImage(ig);
            gr.CopyFromScreen(new Point(0, 0), new Point(0, 0), rtg.Size);
            pictureBox1.Width = rtg.Width;
            pictureBox1.Height = rtg.Height;
            pictureBox1.BackgroundImage = ig;
            this.Size = rtg.Size;
            this.Location = new Point(0, 0);
        }

        private void CopyScream_MouseClick(object sender, MouseEventArgs e)
        {/*
            MoseKeyboard.x = e.X;
            MoseKeyboard.y = e.Y;
            this.Dispose();*/
        }

        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            MoseKeyboard.x = e.X;
            MoseKeyboard.y = e.Y;
            this.Dispose();
        }

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            
            label1.Text = "(" + e.X.ToString() + "," + e.Y.ToString() + ")";            
            if(e.X+label1.Width+5 >= Screen.PrimaryScreen.Bounds.Width)
                label1.Location = new Point(e.X - 5 - label1.Width, e.Y + 5);
            else if (e.Y + label1.Height+5 >= Screen.PrimaryScreen.Bounds.Height)
                label1.Location = new Point(e.X + 5, e.Y - 5 - label1.Height);
            else if ((e.X + label1.Width + 5 >= Screen.PrimaryScreen.Bounds.Width) && (e.Y + label1.Height + 5 >= Screen.PrimaryScreen.Bounds.Height))
                label1.Location = new Point(e.X - 5 - label1.Width, e.Y - 5 - label1.Height);
            else
                label1.Location = new Point(e.X + 5, e.Y + 5);
        }
    }
}